﻿namespace CatClient.Configuration
{
    using System;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;

    public class Server
    {
        private int _port = 2280;

        private int _httpPort = 8080;

        private bool _enabled = true;

        public string Ip
        {
            get;
            private set;
        }

        public int Port
        {
            get
            {
                return this._port;
            }
            private set
            {
                this._port = value;
            }
        }

        public int HttpPort
        {
            get
            {
                return this._httpPort;
            }
            private set
            {
                this._httpPort = value;
            }
        }

        public bool Enabled
        {
            get
            {
                return this._enabled;
            }
            private set
            {
                this._enabled = value;
            }
        }

        public Server(string ip, int port = 2280, int httpPort = 8080, bool enabled = true)
        {
            this.Ip = ip;
            this.Port = port;
            this.HttpPort = httpPort;
            this.Enabled = enabled;
        }

        public override bool Equals(object obj)
        {
            Server server = (Server)obj;
            if (server == null)
            {
                return false;
            }
            if (server == this)
            {
                return true;
            }
            bool flag = this.Ip == server.Ip;
            if (!flag)
            {
                return flag;
            }
            flag = (this.Enabled == server.Enabled);
            if (!flag)
            {
                return flag;
            }
            flag = (this.Port == server.Port);
            if (!flag)
            {
                return flag;
            }
            return this.Ip.Equals(server.Ip);
        }

        public override int GetHashCode()
        {
            int num = 17;
            int num2 = base.GetType().GetHashCode();
            num = 37 * num + num2;
            num2 = this.Port;
            num = 37 * num + num2;
            num2 = this.HttpPort;
            num = 37 * num + num2;
            num2 = this.Ip.GetHashCode();
            return 37 * num + num2;
        }

        public override string ToString()
        {
            return string.Format("{0}:{1}", this.Ip, this.Port);
        }
    }
}

